<!DOCTYPE html>



  


<html class="theme-next muse use-motion" lang>
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform">
<meta http-equiv="Cache-Control" content="no-siteapp">
















  
  
  <link href="/blogs/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css">







<link href="/blogs/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css">

<link href="/blogs/css/main.css?v=5.1.4" rel="stylesheet" type="text/css">


  <link rel="apple-touch-icon" sizes="180x180" href="/blogs/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/blogs/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/blogs/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/blogs/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Linux,">










<meta name="keywords" content="Linux">
<meta property="og:type" content="article">
<meta property="og:title" content="前端必知的Linux--命令篇">
<meta property="og:url" content="https://wangzichong.gitee.io/blogs/2019/08/04/t-Linux/linux-2/index.html">
<meta property="og:site_name" content="Reading Notes">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2019-08-15T14:06:29.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="前端必知的Linux--命令篇">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/blogs/',
    scheme: 'Muse',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: 'Author'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://wangzichong.gitee.io/blogs/2019/08/04/t-Linux/linux-2/">





  <title>前端必知的Linux--命令篇 | Reading Notes</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="default">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/blogs/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Reading Notes</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">Codes Change Life</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/blogs/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br>
            
            Home
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/blogs/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br>
            
            Tags
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/blogs/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br>
            
            Categories
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/blogs/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br>
            
            Archives
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br>
            
            Search
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off" placeholder="Searching..." spellcheck="false" type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://wangzichong.gitee.io/blogs/blogs/2019/08/04/t-Linux/linux-2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="zichong">
      <meta itemprop="description" content>
      <meta itemprop="image" content="/blogs/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Reading Notes">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">前端必知的Linux--命令篇</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2019-08-04T20:48:52+08:00">
                2019-08-04
              </time>
            

            

            
          </span>

          
            <span class="post-category">
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/blogs/categories/学习笔记/" itemprop="url" rel="index">
                    <span itemprop="name">学习笔记</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          
              <div class="post-description">
                   
              </div>
          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <a id="more"></a>
<!-- ### Linux 常用命令
以下命令只针对root用户, 如果非root用户, 出现的情况不一致的话, 需要加sudo
* 查看进程: ps aux
* 查看端口: ss -anp | grep 80
  * grep命令是一种强大的文本搜索工具, 它能使用正则表达式搜索文本, 并把匹配的行打印出来 -->

<h3 id="命令基本格式"><a href="#命令基本格式" class="headerlink" title="命令基本格式"></a>命令基本格式</h3><h4 id="命令提示符"><a href="#命令提示符" class="headerlink" title="命令提示符"></a>命令提示符</h4><p>[root@localhost ~]#</p>
<ul>
<li>root 当前登录用户</li>
<li>localhost 主机名</li>
<li>~ 当前⼯作⽬录, 默认是当前用户的家目录, root就是/root, 普通用户是 /home/⽤户名</li>
<li>命令提示符 超级⽤户是 #, 普通用户是 $</li>
</ul>
<h4 id="命令格式"><a href="#命令格式" class="headerlink" title="命令格式"></a>命令格式</h4><p>一个完整的命令由 命令 [选项] [参数] 组成, e.g., ls -a Lib</p>
<ul>
<li>命令 [选项] [参数], 其中 选项与参数 可以省略</li>
<li>当有多个选项时, 可以写在一起, e.g., ls -al</li>
<li>参数是命令的操作对象, 一般文件、目录、用户和进程等可以作为参数被命令操作, e.g., ls -a Lib<ul>
<li>命令一般都需要加入参数, 用于指定命令操作的对象是谁, 如果可以省略参数, 则一般都有默认参数, (ls 命令后面没有指定参数, 默认参数是当前所在位置, 所以会显示当前目录下的文件名)</li>
</ul>
</li>
<li>命令的选项用于调整命令功能, 而命令的参数是这个命令的操作对象</li>
</ul>
<h3 id="文件权限"><a href="#文件权限" class="headerlink" title="文件权限"></a>文件权限</h3><h4 id="显示详细信息"><a href="#显示详细信息" class="headerlink" title="显示详细信息"></a>显示详细信息</h4><p>ls -l<br>drwxr-xr-x .  1 root  root   800 Sep 16 00:19 logs</p>
<table>
<thead>
<tr>
<th>drwxr-xr-x</th>
<th>.</th>
<th>1</th>
<th>root</th>
<th>root</th>
<th>800</th>
<th>Sep 16 00:19</th>
<th>logs</th>
</tr>
</thead>
<tbody><tr>
<td>⽂件类型和权限</td>
<td>ACL权限</td>
<td>硬链接引用计数</td>
<td>所有者</td>
<td>所属组</td>
<td>⽂件大小</td>
<td>最后修改时间</td>
<td>⽂件名</td>
</tr>
</tbody></table>
<h4 id="权限详解"><a href="#权限详解" class="headerlink" title="权限详解"></a>权限详解</h4><p><strong>drwxr-xr-x .  1 root  root   800 Sep 16 00:19 logs</strong><br>表示logs是个目录文件, root拥有读写执行的权限, 和root所在同一个root组里的用户拥有只读和执行权限, 剩下其他用户拥有只读和执行权限</p>
<p>d: 第1位表示文件类型, d是目录文件、l是链接文件、-是普通文件、p是管道<br>rwx: 第2-4位表示这个文件的属主拥有的权限, r是读、w是写、x是执行<br>r-x: 第5-7位表示和这个文件属主所在同一个组的用户所具有的权限<br>r-x: 第8-10位表示其他用户所具有的权限</p>
<h5 id="文件权限-1"><a href="#文件权限-1" class="headerlink" title="文件权限"></a>文件权限</h5><p>文件调用权限分为三级: 文件拥有者(U)、群组(G)、其他(O)<br>使用 chmod xxx file 来改变文件的权限, e.g., chmod 755 file</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">// 将所有的权限用二进制形式表现出来，并进一步转变成八进制数字</span><br><span class="line">rwx = 111 = 7</span><br><span class="line">rw- = 110 = 6</span><br><span class="line">r-x = 101 = 5</span><br><span class="line">r-- = 100 = 4</span><br><span class="line">-wx = 011 = 3</span><br><span class="line">-w- = 010 = 2</span><br><span class="line">--x = 001 = 1</span><br><span class="line">--- = 000 = 0</span><br></pre></td></tr></table></figure>

<p>r(read) = 读取属性 -&gt; 4<br>w(write) = 写入属性 -&gt; 2<br>x(execute) = 执行属性 -&gt; 1</p>
<h5 id="修改文件权限"><a href="#修改文件权限" class="headerlink" title="修改文件权限"></a>修改文件权限</h5><p>chmod 755 file, (如果要对文件目录里面所有的文件都起效果, 则需要 参数R, 递归)<br>第1个数字表示文件所有者的权限<br>第2个数字表示与文件所有者同属一个用户组的其他用户的权限<br>第3个数字表示其它用户组的权限<br>即</p>
<ul>
<li>文件所有者可读可写可执行(7)</li>
<li>与文件所有者同属一个用户组的其他用户可读可执行(5)</li>
<li>其它用户组可读可执行(5)</li>
</ul>
<h3 id="⽂件处理命令"><a href="#⽂件处理命令" class="headerlink" title="⽂件处理命令"></a>⽂件处理命令</h3><h4 id="mkdir"><a href="#mkdir" class="headerlink" title="mkdir"></a>mkdir</h4><p>建⽴目录 make directory</p>
<ul>
<li><p>创建 test 目录</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir test</span><br></pre></td></tr></table></figure>
</li>
<li><p>递归创建多个目录, test/a</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mkdir -p test/a</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h4 id="cd"><a href="#cd" class="headerlink" title="cd"></a>cd</h4><p>切换所在⽬录 change directory</p>
<ul>
<li>cd [目录]<ul>
<li>~ 家目录</li>
<li>. 当前目录</li>
<li>.. 上级目录</li>
</ul>
</li>
</ul>
<p>相对路径是参照当前所在目录<br>绝对路径是从根⽬录开始<br>按TAB键可以补全命令和目录</p>
<h4 id="pwd"><a href="#pwd" class="headerlink" title="pwd"></a>pwd</h4><p>显示当前目录 pwd</p>
<h4 id="rmdir"><a href="#rmdir" class="headerlink" title="rmdir"></a>rmdir</h4><p>删除空目录 remove empty directory<br>rmdir [⽬录名]</p>
<h4 id="rm"><a href="#rm" class="headerlink" title="rm"></a>rm</h4><p>删除文件或者⽬录 remove (-force 强制删除, -recursive 删除目录)<br>rm [⽂件或者目录]</p>
<ul>
<li><p>删除文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rm file</span><br></pre></td></tr></table></figure>
</li>
<li><p>删除目录(会有各种提示)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rm -r directory</span><br></pre></td></tr></table></figure>
</li>
<li><p>强制删除目录(向下递归强制删除目录以及目录里面的所有内容, 没有任何提示)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">rm -rf directory</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h4 id="cp"><a href="#cp" class="headerlink" title="cp"></a>cp</h4><p>复制命令 copy<br>copy [源文件或者目录] [重命名源文件或者目录]<br>-r 复制⽬录, 默认是复制文件<br>-p 连带文件属性复制<br>-d 若源文件是链接文件, 则复制链接属性<br>-a 相当于 -rpd</p>
<ul>
<li><p>复制指定目录的文件到指定目录</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cp ~/test/aaa/pp.js ~/test/ttt/yy.js</span><br></pre></td></tr></table></figure>
</li>
<li><p>如果都是当前路径, 则直接文件名即可</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cp pp.js yy.js</span><br></pre></td></tr></table></figure>
</li>
<li><p>复制指定目录到指定目录(包含目录里面的内容)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cp -r  ~/test/aaa ~/test/ttt/ooo</span><br></pre></td></tr></table></figure>
</li>
<li><p>如果都是当前路径, 则直接目录名即可</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cp -r aaa ooo</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h4 id="mv"><a href="#mv" class="headerlink" title="mv"></a>mv</h4><p>移动文件或者改名 move<br>mv [源文件或目录] [目标文件或目录]</p>
<ul>
<li>移动文件<ul>
<li>与cp类似, 参考cp</li>
</ul>
</li>
<li>改名<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">mv aaa.js bbb.js</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h4 id="ln"><a href="#ln" class="headerlink" title="ln"></a>ln</h4><p>为某一个文件在另外一个位置建立一个同步的链接, 当需要在不同的目录, 用到相同的文件时, 不需要在每一个需要的目录下都放一个必须相同的文件, 只要在某个固定的目录, 放上该文件, 然后在其它的目录下用ln命令链接（link）它就可以, 不必重复的占用磁盘空间<br>ln -s [源⽂件] [⽬标⽂文件]</p>
<ul>
<li><p>创建软链接</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">ln -s  gg.js ttt/dddd.js</span><br></pre></td></tr></table></figure>

<ul>
<li>修改任意一个⽂件, 另一个会改变, 删除源⽂件, 软链接不能使用</li>
</ul>
</li>
</ul>
<h3 id="⽂件搜索命令"><a href="#⽂件搜索命令" class="headerlink" title="⽂件搜索命令"></a>⽂件搜索命令</h3><p>在Linux中, 有很多方法可以做到文件搜索, e.g., find, locate, whereis, which, type</p>
<h4 id="find"><a href="#find" class="headerlink" title="find"></a>find</h4><p>find是最常见和最强大的查找命令, 可以用它找到任何想找的文件<br>⽂件搜索命令<br>find [搜索范围] [搜索条件]</p>
<h5 id="按名称搜索"><a href="#按名称搜索" class="headerlink" title="按名称搜索"></a>按名称搜索</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">find ~ -name yy.js</span><br></pre></td></tr></table></figure>

<h5 id="按通配符搜索"><a href="#按通配符搜索" class="headerlink" title="按通配符搜索"></a>按通配符搜索</h5><ul>
<li>* 匹配任意字符串</li>
<li>? 匹配任意一个字符</li>
<li>[] 匹配任意⼀个中括号内的字符<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">// 查找当前路径下所有包含 .js 的文件(find . 等价于 find ./)</span><br><span class="line">find . -name <span class="string">'*.js'</span></span><br><span class="line"></span><br><span class="line">// 查找当前路径下所有 xx.js 的文件</span><br><span class="line">find . -name <span class="string">'??.js'</span></span><br><span class="line"></span><br><span class="line">// 查找当前路径下所有 t.js 或者 tt.js 文件</span><br><span class="line">find . -name <span class="string">'[t]t.js'</span></span><br></pre></td></tr></table></figure>

</li>
</ul>
<h5 id="不区分大小写搜索"><a href="#不区分大小写搜索" class="headerlink" title="不区分大小写搜索"></a>不区分大小写搜索</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">find . -iname Tt.js</span><br></pre></td></tr></table></figure>

<h5 id="按所有者搜索"><a href="#按所有者搜索" class="headerlink" title="按所有者搜索"></a>按所有者搜索</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">find . -user root -name tt.js</span><br></pre></td></tr></table></figure>

<h5 id="按时间搜索"><a href="#按时间搜索" class="headerlink" title="按时间搜索"></a>按时间搜索</h5><p>查找五天内修改过的内容的.js文件</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">find test/*.js -mtime -5</span><br></pre></td></tr></table></figure>

<ul>
<li>参数一<ul>
<li>atime ⽂件访问时间</li>
<li>ctime 改变⽂件属性</li>
<li>mtime 修改⽂件内容</li>
</ul>
</li>
<li>参数二<ul>
<li>-5 5天内修改的文件</li>
<li>5 5天前当前修改的文件</li>
<li>+5 5天前修改的文件</li>
</ul>
</li>
</ul>
<h5 id="按大小搜索"><a href="#按大小搜索" class="headerlink" title="按大小搜索"></a>按大小搜索</h5><p>按照文件的大小搜索,(k小写, M大写)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">find . -size 100k</span><br></pre></td></tr></table></figure>

<ul>
<li>参数(M同理)<ul>
<li>-8k 小于8K</li>
<li>8k 等于8K</li>
<li>+8k 大于8K</li>
</ul>
</li>
</ul>
<h5 id="按i节点搜索"><a href="#按i节点搜索" class="headerlink" title="按i节点搜索"></a>按i节点搜索</h5><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">find . -inum 123456</span><br></pre></td></tr></table></figure>

<h4 id="grep"><a href="#grep" class="headerlink" title="grep"></a>grep</h4><ul>
<li>在./test/gg.js文件中 查找test字符串<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">grep test ./test/gg.js</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h4 id="总结"><a href="#总结" class="headerlink" title="总结"></a>总结</h4><ul>
<li>凡是搜索文件名, 就用find</li>
<li>凡是搜索文件内容, 就要grep(当然为了提高效率可以结合find使用)</li>
</ul>
<h3 id="帮助命令"><a href="#帮助命令" class="headerlink" title="帮助命令"></a>帮助命令</h3><h4 id="man"><a href="#man" class="headerlink" title="man"></a>man</h4><p>man命令 获取指定命令的帮助</p>
<ul>
<li>查看ls的帮助<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">man ls</span><br></pre></td></tr></table></figure>

</li>
</ul>
<h3 id="压缩与解压缩命令"><a href="#压缩与解压缩命令" class="headerlink" title="压缩与解压缩命令"></a>压缩与解压缩命令</h3><p>常见的压缩格式</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">.zip(zip)</span><br><span class="line">.gz(gzip)</span><br><span class="line">.bz2(bzip2)</span><br><span class="line">.tar.gz(tar + gzip)</span><br><span class="line">.tar.bz2(tar + bzip2)</span><br></pre></td></tr></table></figure>

<h4 id="zip格式"><a href="#zip格式" class="headerlink" title="zip格式"></a>zip格式</h4><p><strong>可以压缩目录</strong><br>yum install zip<br>yum install unzip</p>
<ul>
<li><p>压缩⽂件</p>
<ul>
<li>zip [压缩后的文件名] [压缩文件的路径]<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">// 将当前路径下tt.js文件压缩为test.zip</span><br><span class="line">zip test tt.js</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>压缩⽬录</p>
<ul>
<li>zip -r [压缩后的文件名] [压缩目录的路径]<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">// 将当前路径下的 test目录压缩为 testZip</span><br><span class="line">zip -r testZip test</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>解压 </p>
<ul>
<li>unzip 压缩文件名<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">unzip test.zip</span><br></pre></td></tr></table></figure>

</li>
</ul>
</li>
</ul>
<h4 id="gzip格式"><a href="#gzip格式" class="headerlink" title="gzip格式"></a>gzip格式</h4><p><strong>不能压缩目录, 能压缩目录下面的子文件</strong></p>
<ul>
<li><p>压缩文件</p>
<ul>
<li>gzip [源文件], (源文件消失)</li>
<li>gzip -c [源文件] &gt; [压缩文件], (源文件不消失)</li>
<li>gzip -r [目录], (压缩目录下所有子文件, 但是不压缩目录)<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">// 压缩当前路径下gg.js文件</span><br><span class="line">gzip gg.js</span><br><span class="line"></span><br><span class="line">// 将当前路径下的gg.js文件压缩为 gg.js.gz</span><br><span class="line">gzip -c gg.js &gt; gg.js.gz</span><br><span class="line"></span><br><span class="line">// 压缩当前路径下, test目录下面的所有子文件, 不包含子目录</span><br><span class="line">gzip -r test</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>解压</p>
<ul>
<li>gzip -d [压缩文件], (不保留压缩包)</li>
<li>gunzip [压缩文件], (不保留压缩包)<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">// 解压缩当前路径下的 test.js.gz文件, 不保留压缩包</span><br><span class="line">gzip -d test.js.gz</span><br><span class="line">gunzip test.js.gz</span><br></pre></td></tr></table></figure>

</li>
</ul>
</li>
</ul>
<h4 id="bzip2格式"><a href="#bzip2格式" class="headerlink" title="bzip2格式"></a>bzip2格式</h4><p><strong>不能压缩目录</strong><br>yum install bzip2<br>yum install bunzip2</p>
<ul>
<li><p>压缩文件</p>
<ul>
<li>bzip2 [源文件], (不保留源文件)</li>
<li>bzip2 -k [源文件], (保留源文件)<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">// 压缩当前路径下 test.js 文件, 不保留源文件</span><br><span class="line">bzip2 test.js</span><br><span class="line">// 压缩当前路径下 test.js 文件, 保留源文件</span><br><span class="line">bzip2 -k test.js</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>解压</p>
<ul>
<li>bzip2 -d [压缩文件], (不保留压缩文件)</li>
<li>bunzip2 [压缩文件], (不保留压缩文件)</li>
</ul>
</li>
</ul>
<h4 id="tar-gz格式-tar-bz2格式"><a href="#tar-gz格式-tar-bz2格式" class="headerlink" title="tar.gz格式/tar.bz2格式"></a>tar.gz格式/tar.bz2格式</h4><p>tar用于打包备份文件(多个文件)<br>-c 建立新的备份文件<br>-v 显示指令执行过程<br>-f 指定打包后的文件名<br>-x 从备份文件中还原文件</p>
<ul>
<li><p>打包文件</p>
<ul>
<li>tar -cvf [打包文件名] [源文件]<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">// 将当前路径下 test.js 文件打包为 test.tar</span><br><span class="line">tar -cvf test.tar test.js</span><br><span class="line"></span><br><span class="line">// 将当前路径下的所有 .js 文件打包为 test.tar</span><br><span class="line">tar -cvf test.tar *.js</span><br><span class="line"></span><br><span class="line">// 将当前路径下的 test.tar 文件进行 zip / gzip 压缩</span><br><span class="line">zip / gzip test.tar</span><br></pre></td></tr></table></figure>
</li>
</ul>
</li>
<li><p>还原打包</p>
<ul>
<li>tar -xvf [打包文件]<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">// 将当前路径下的 test.tar文件还原</span><br><span class="line">tar -xvf test.tar</span><br></pre></td></tr></table></figure>

</li>
</ul>
</li>
</ul>
<h3 id="关机-重启-登出命令"><a href="#关机-重启-登出命令" class="headerlink" title="关机/重启/登出命令"></a>关机/重启/登出命令</h3><h4 id="shutdown"><a href="#shutdown" class="headerlink" title="shutdown"></a>shutdown</h4><p>time: 设定关机的时间, e.g., shutdown 18:00<br>-c: 取消目前已经进行中的关机动作<br>-r: 重启<br>-h: 关机后停机</p>
<h4 id="logout"><a href="#logout" class="headerlink" title="logout"></a>logout</h4><p>logout / exit 退出登录</p>
<h3 id="查看登录用户信息命令"><a href="#查看登录用户信息命令" class="headerlink" title="查看登录用户信息命令"></a>查看登录用户信息命令</h3><h4 id="w-who-比w显示的稍微少点"><a href="#w-who-比w显示的稍微少点" class="headerlink" title="w/who(比w显示的稍微少点)"></a>w/who(比w显示的稍微少点)</h4><p>查看登录用户的信息</p>
<ul>
<li>USER 登录的用户名</li>
<li>TTY 登录的终端 (tty1: 本地终端, pts/0: 远程终端)</li>
<li>FROM 登录的IP</li>
<li>LOGIN 登录时间</li>
<li>IDLE ⽤户闲置时间</li>
<li>JCPU 该终端所有进程占⽤的时间</li>
<li>PCPU 当前进程所占⽤的时间</li>
<li>WHAT 正在执行的命令</li>
</ul>
<h4 id="last"><a href="#last" class="headerlink" title="last"></a>last</h4><p>查看当前登录和过去登录的用户信息(默认读取 /var/log/wtmp ⽂件)</p>
<ul>
<li>用户名</li>
<li>登录终端</li>
<li>登录IP</li>
<li>登录时间 退出时间(在线时间)</li>
</ul>
<h4 id="lastb"><a href="#lastb" class="headerlink" title="lastb"></a>lastb</h4><p>查看登录失败的用户信息</p>
<ul>
<li>用户名</li>
<li>登录终端</li>
<li>登录IP</li>
<li>登录时间</li>
</ul>
<h4 id="lastlog"><a href="#lastlog" class="headerlink" title="lastlog"></a>lastlog</h4><p>查看所有用户的最后⼀次登录时间</p>
<ul>
<li>用户名</li>
<li>登录终端</li>
<li>登录IP</li>
<li>最后⼀次登录时间</li>
</ul>
<h3 id="⽤户和用户组命令"><a href="#⽤户和用户组命令" class="headerlink" title="⽤户和用户组命令"></a>⽤户和用户组命令</h3><p>使用操作系统的人都是用户<br>⽤户组是具有相同系统权限的⼀组用户</p>
<h4 id="用户与用户组文件夹"><a href="#用户与用户组文件夹" class="headerlink" title="用户与用户组文件夹"></a>用户与用户组文件夹</h4><h5 id="etc-group"><a href="#etc-group" class="headerlink" title="/etc/group"></a>/etc/group</h5><p>存储当前系统中所有⽤户组信息</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cat /etc/group</span><br></pre></td></tr></table></figure>

<p>group:x:123:abc,def<br>zichong:x:1000:<br>root:x:0:</p>
<ul>
<li>组名称:组密码占位符:组编号:组中⽤户名列表</li>
<li>root 组编号为0</li>
<li>1-499为系统预留的编号, 预留给安装的软件和服务的</li>
<li>用户手动创建的用户组从500开始</li>
<li>组密码占位符都是x</li>
</ul>
<h5 id="etc-gshadow"><a href="#etc-gshadow" class="headerlink" title="/etc/gshadow"></a>/etc/gshadow</h5><p>存放当前系统中用户组的密码信息<br>zichong:!::<br>root:::</p>
<ul>
<li>组名称 组密码 组管理者 组中用户名</li>
</ul>
<h5 id="etc-passwd"><a href="#etc-passwd" class="headerlink" title="/etc/passwd"></a>/etc/passwd</h5><p>存储当前系统中所有⽤户的信息<br>root:x:0:0:root:/root:/bin/bash<br>zichong:x:1000:1000::/home/zichong:/bin/bash</p>
<ul>
<li>⽤户名:密码占位符:⽤户编号:⽤户注释信息:⽤户主目录:shell类型</li>
</ul>
<h5 id="etc-shadow"><a href="#etc-shadow" class="headerlink" title="/etc/shadow"></a>/etc/shadow</h5><p>存放当前系统中所有用户的密码信息<br>user:xxx:::::::</p>
<ul>
<li>用户名:密码:</li>
</ul>
<h4 id="用户命令"><a href="#用户命令" class="headerlink" title="用户命令"></a>用户命令</h4><h5 id="adduser"><a href="#adduser" class="headerlink" title="adduser"></a>adduser</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">adduser zichong</span><br><span class="line"><span class="meta">#</span><span class="bash"> 创建zichong用户</span></span><br><span class="line"></span><br><span class="line">adduser -g test zichong</span><br><span class="line"><span class="meta">#</span><span class="bash"> 创建zichong用户, 并指定到<span class="built_in">test</span>组</span></span><br></pre></td></tr></table></figure>

<h5 id="passwd"><a href="#passwd" class="headerlink" title="passwd"></a>passwd</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">passwd zichong</span><br><span class="line"><span class="meta">#</span><span class="bash"> 指定(修改)zichong用户的密码</span></span><br></pre></td></tr></table></figure>

<h5 id="userdel"><a href="#userdel" class="headerlink" title="userdel"></a>userdel</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">userdel zichong</span><br><span class="line"><span class="meta">#</span><span class="bash"> 删除zichong用户</span></span><br><span class="line"></span><br><span class="line">userdel -r zichong</span><br><span class="line"><span class="meta">#</span><span class="bash"> 删除子翀用户, 及其家目录及文件一并删除</span></span><br></pre></td></tr></table></figure>

<h5 id="usermod"><a href="#usermod" class="headerlink" title="usermod"></a>usermod</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">usermod -l zichong2 zichong</span><br><span class="line"><span class="meta">#</span><span class="bash"> 将zichong用户名修改为zichong2</span></span><br><span class="line"></span><br><span class="line">usermod -g stu zichong</span><br><span class="line"><span class="meta">#</span><span class="bash"> 将zichong用户的组改为stu</span></span><br></pre></td></tr></table></figure>

<h5 id="whoami"><a href="#whoami" class="headerlink" title="whoami"></a>whoami</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">whoami</span><br><span class="line"><span class="meta">#</span><span class="bash"> 显示登录的⽤户名</span></span><br></pre></td></tr></table></figure>

<h5 id="id-zichong"><a href="#id-zichong" class="headerlink" title="id zichong"></a>id zichong</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">id zichong</span><br><span class="line"><span class="meta">#</span><span class="bash"> 显示指定⽤户信息, 包括用户编号, 用户名, 主要组的编号及名称, 附属组列表</span></span><br></pre></td></tr></table></figure>

<h5 id="groups-zichong"><a href="#groups-zichong" class="headerlink" title="groups zichong"></a>groups zichong</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">groups zichong</span><br><span class="line"><span class="meta">#</span><span class="bash"> 显示⽤户所在的所有组</span></span><br></pre></td></tr></table></figure>

<h5 id="finger-zichong"><a href="#finger-zichong" class="headerlink" title="finger zichong"></a>finger zichong</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">finger zhangsan</span><br><span class="line"><span class="meta">#</span><span class="bash"> 显示⽤户详细资料(需手动安装, yum install finger)</span></span><br></pre></td></tr></table></figure>

<h4 id="用户组命令"><a href="#用户组命令" class="headerlink" title="用户组命令"></a>用户组命令</h4><h5 id="groupadd"><a href="#groupadd" class="headerlink" title="groupadd"></a>groupadd</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">groupadd student</span><br><span class="line"><span class="meta">#</span><span class="bash"> 添加student用户组</span></span><br><span class="line"></span><br><span class="line">groupadd -g 222 student</span><br><span class="line"><span class="meta">#</span><span class="bash"> 添加student用户组, 并指定编号为222</span></span><br></pre></td></tr></table></figure>

<h5 id="groupdel"><a href="#groupdel" class="headerlink" title="groupdel"></a>groupdel</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">groupdel student</span><br><span class="line"><span class="meta">#</span><span class="bash"> 删除student用户组</span></span><br></pre></td></tr></table></figure>

<h5 id="groupmod"><a href="#groupmod" class="headerlink" title="groupmod"></a>groupmod</h5><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">groupmod -n stu student</span><br><span class="line"><span class="meta">#</span><span class="bash"> 将student用户组名修改为stu</span></span><br><span class="line"></span><br><span class="line">groupmod -g 111 stu</span><br><span class="line"><span class="meta">#</span><span class="bash"> 将stu用户组编号修改为s111</span></span><br></pre></td></tr></table></figure>

<h3 id="常见目录"><a href="#常见目录" class="headerlink" title="常见目录"></a>常见目录</h3><h4 id="bin"><a href="#bin" class="headerlink" title="/bin"></a>/bin</h4><p>存放⼆进制可执行文件(ls, cat, mkdir等), 常⽤命令一般都在这⾥</p>
<h4 id="boot"><a href="#boot" class="headerlink" title="/boot"></a>/boot</h4><p>存放用于系统引导时使用的各种⽂件</p>
<h4 id="etc"><a href="#etc" class="headerlink" title="/etc"></a>/etc</h4><p>存放系统管理和配置文件</p>
<h4 id="home"><a href="#home" class="headerlink" title="/home"></a>/home</h4><p>存放所有用户文件的根目录, 是用户主目录的基点, ⽐如创建一个普通用户(user), 其主(家)目录就是 /home/user, 可以用~user表示</p>
<h4 id="proc"><a href="#proc" class="headerlink" title="/proc"></a>/proc</h4><p>虚拟⽂件系统目录, 是系统内存的映射, 可直接访问这个目录来获取系统信息, 这些文件是操作系统运行的时候产生的</p>
<h4 id="root"><a href="#root" class="headerlink" title="/root"></a>/root</h4><p>超级用户(系统管理员)专用的主(家)目录</p>
<h4 id="usr"><a href="#usr" class="headerlink" title="/usr"></a>/usr</h4><p>⽤于存放系统应用程序, 源代码, 静态库, 动态库等<br>/usr 可以理解为 C:/Windows/<br>/usr/lib 可以理解为 C:/Windows/System32<br>/usr/local 可以理解为 C:/Progrem Files/</p>
<h4 id="opt"><a href="#opt" class="headerlink" title="/opt"></a>/opt</h4><p>额外安装的可选应用程序包所放置的位置, 可以理解为 D:/Software, 一般情况下, 可以把 tomcat 等都安装到这⾥<br>通过yum安装的文件, 会倒 /usr/local 里</p>
<h4 id="sbin"><a href="#sbin" class="headerlink" title="/sbin"></a>/sbin</h4><p>存放二进制可执行⽂件, 只有root才能访问, 这里存放的是系统管理员使用的系统级别的管理命令和程序, 如ifconfig等</p>
<h4 id="dev"><a href="#dev" class="headerlink" title="/dev"></a>/dev</h4><p>⽤于存放设备文件(指向硬件的快捷方式)</p>
<h4 id="mnt"><a href="#mnt" class="headerlink" title="/mnt"></a>/mnt</h4><p>系统管理员安装临时文件系统的安装点, 系统提供这个目录是让用户临时挂载其他的文件系统</p>
<h4 id="lib"><a href="#lib" class="headerlink" title="/lib"></a>/lib</h4><p>存放跟文件系统中的程序运⾏所需要的共享库及内核模块, 共享库又叫动态链接共享库, 作用类似windows里的.dll文件, 存放了根⽂件系统程序运行所需的共享文件</p>
<h4 id="tmp"><a href="#tmp" class="headerlink" title="/tmp"></a>/tmp</h4><p>⽤于存放各种临时文件, 是公⽤的临时文件存储点</p>
<h4 id="var"><a href="#var" class="headerlink" title="/var"></a>/var</h4><p>⽤于存放运行时需要改变数据的⽂件, 也是某些⼤⽂件的溢出区, ⽐如各种服务的⽇志文件(系统启动⽇志等)等</p>
<h4 id="lost-found"><a href="#lost-found" class="headerlink" title="/lost+found"></a>/lost+found</h4><p>这个⽬录平时是空的, 系统⾮正常关机⽽留下”无家可归”的文件(windows下叫xxx.chk)就在这⾥</p>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/blogs/tags/Linux/" rel="tag"># Linux</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/blogs/2019/08/03/t-Linux/linux/" rel="next" title="前端必知的Linux--扫盲篇">
                <i class="fa fa-chevron-left"></i> 前端必知的Linux--扫盲篇
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/blogs/2019/08/11/t-Linux/linux-3/" rel="prev" title="前端必知的Linux--Shell入门">
                前端必知的Linux--Shell入门 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">zichong</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/blogs/archives/">
              
                  <span class="site-state-item-count">39</span>
                  <span class="site-state-item-name">posts</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/blogs/categories/index.html">
                  <span class="site-state-item-count">2</span>
                  <span class="site-state-item-name">categories</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/blogs/tags/index.html">
                  <span class="site-state-item-count">14</span>
                  <span class="site-state-item-name">tags</span>
                </a>
              </div>
            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#命令基本格式"><span class="nav-number">1.</span> <span class="nav-text">命令基本格式</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#命令提示符"><span class="nav-number">1.1.</span> <span class="nav-text">命令提示符</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#命令格式"><span class="nav-number">1.2.</span> <span class="nav-text">命令格式</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#文件权限"><span class="nav-number">2.</span> <span class="nav-text">文件权限</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#显示详细信息"><span class="nav-number">2.1.</span> <span class="nav-text">显示详细信息</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#权限详解"><span class="nav-number">2.2.</span> <span class="nav-text">权限详解</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#文件权限-1"><span class="nav-number">2.2.1.</span> <span class="nav-text">文件权限</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#修改文件权限"><span class="nav-number">2.2.2.</span> <span class="nav-text">修改文件权限</span></a></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#⽂件处理命令"><span class="nav-number">3.</span> <span class="nav-text">⽂件处理命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#mkdir"><span class="nav-number">3.1.</span> <span class="nav-text">mkdir</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#cd"><span class="nav-number">3.2.</span> <span class="nav-text">cd</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#pwd"><span class="nav-number">3.3.</span> <span class="nav-text">pwd</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#rmdir"><span class="nav-number">3.4.</span> <span class="nav-text">rmdir</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#rm"><span class="nav-number">3.5.</span> <span class="nav-text">rm</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#cp"><span class="nav-number">3.6.</span> <span class="nav-text">cp</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#mv"><span class="nav-number">3.7.</span> <span class="nav-text">mv</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#ln"><span class="nav-number">3.8.</span> <span class="nav-text">ln</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#⽂件搜索命令"><span class="nav-number">4.</span> <span class="nav-text">⽂件搜索命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#find"><span class="nav-number">4.1.</span> <span class="nav-text">find</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#按名称搜索"><span class="nav-number">4.1.1.</span> <span class="nav-text">按名称搜索</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#按通配符搜索"><span class="nav-number">4.1.2.</span> <span class="nav-text">按通配符搜索</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#不区分大小写搜索"><span class="nav-number">4.1.3.</span> <span class="nav-text">不区分大小写搜索</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#按所有者搜索"><span class="nav-number">4.1.4.</span> <span class="nav-text">按所有者搜索</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#按时间搜索"><span class="nav-number">4.1.5.</span> <span class="nav-text">按时间搜索</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#按大小搜索"><span class="nav-number">4.1.6.</span> <span class="nav-text">按大小搜索</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#按i节点搜索"><span class="nav-number">4.1.7.</span> <span class="nav-text">按i节点搜索</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#grep"><span class="nav-number">4.2.</span> <span class="nav-text">grep</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#总结"><span class="nav-number">4.3.</span> <span class="nav-text">总结</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#帮助命令"><span class="nav-number">5.</span> <span class="nav-text">帮助命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#man"><span class="nav-number">5.1.</span> <span class="nav-text">man</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#压缩与解压缩命令"><span class="nav-number">6.</span> <span class="nav-text">压缩与解压缩命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#zip格式"><span class="nav-number">6.1.</span> <span class="nav-text">zip格式</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#gzip格式"><span class="nav-number">6.2.</span> <span class="nav-text">gzip格式</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#bzip2格式"><span class="nav-number">6.3.</span> <span class="nav-text">bzip2格式</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#tar-gz格式-tar-bz2格式"><span class="nav-number">6.4.</span> <span class="nav-text">tar.gz格式/tar.bz2格式</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#关机-重启-登出命令"><span class="nav-number">7.</span> <span class="nav-text">关机/重启/登出命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#shutdown"><span class="nav-number">7.1.</span> <span class="nav-text">shutdown</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#logout"><span class="nav-number">7.2.</span> <span class="nav-text">logout</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#查看登录用户信息命令"><span class="nav-number">8.</span> <span class="nav-text">查看登录用户信息命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#w-who-比w显示的稍微少点"><span class="nav-number">8.1.</span> <span class="nav-text">w/who(比w显示的稍微少点)</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#last"><span class="nav-number">8.2.</span> <span class="nav-text">last</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#lastb"><span class="nav-number">8.3.</span> <span class="nav-text">lastb</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#lastlog"><span class="nav-number">8.4.</span> <span class="nav-text">lastlog</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#⽤户和用户组命令"><span class="nav-number">9.</span> <span class="nav-text">⽤户和用户组命令</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#用户与用户组文件夹"><span class="nav-number">9.1.</span> <span class="nav-text">用户与用户组文件夹</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#etc-group"><span class="nav-number">9.1.1.</span> <span class="nav-text">/etc/group</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#etc-gshadow"><span class="nav-number">9.1.2.</span> <span class="nav-text">/etc/gshadow</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#etc-passwd"><span class="nav-number">9.1.3.</span> <span class="nav-text">/etc/passwd</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#etc-shadow"><span class="nav-number">9.1.4.</span> <span class="nav-text">/etc/shadow</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#用户命令"><span class="nav-number">9.2.</span> <span class="nav-text">用户命令</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#adduser"><span class="nav-number">9.2.1.</span> <span class="nav-text">adduser</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#passwd"><span class="nav-number">9.2.2.</span> <span class="nav-text">passwd</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#userdel"><span class="nav-number">9.2.3.</span> <span class="nav-text">userdel</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#usermod"><span class="nav-number">9.2.4.</span> <span class="nav-text">usermod</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#whoami"><span class="nav-number">9.2.5.</span> <span class="nav-text">whoami</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#id-zichong"><span class="nav-number">9.2.6.</span> <span class="nav-text">id zichong</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#groups-zichong"><span class="nav-number">9.2.7.</span> <span class="nav-text">groups zichong</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#finger-zichong"><span class="nav-number">9.2.8.</span> <span class="nav-text">finger zichong</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#用户组命令"><span class="nav-number">9.3.</span> <span class="nav-text">用户组命令</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#groupadd"><span class="nav-number">9.3.1.</span> <span class="nav-text">groupadd</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#groupdel"><span class="nav-number">9.3.2.</span> <span class="nav-text">groupdel</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#groupmod"><span class="nav-number">9.3.3.</span> <span class="nav-text">groupmod</span></a></li></ol></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#常见目录"><span class="nav-number">10.</span> <span class="nav-text">常见目录</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#bin"><span class="nav-number">10.1.</span> <span class="nav-text">/bin</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#boot"><span class="nav-number">10.2.</span> <span class="nav-text">/boot</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#etc"><span class="nav-number">10.3.</span> <span class="nav-text">/etc</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#home"><span class="nav-number">10.4.</span> <span class="nav-text">/home</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#proc"><span class="nav-number">10.5.</span> <span class="nav-text">/proc</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#root"><span class="nav-number">10.6.</span> <span class="nav-text">/root</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#usr"><span class="nav-number">10.7.</span> <span class="nav-text">/usr</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#opt"><span class="nav-number">10.8.</span> <span class="nav-text">/opt</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#sbin"><span class="nav-number">10.9.</span> <span class="nav-text">/sbin</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#dev"><span class="nav-number">10.10.</span> <span class="nav-text">/dev</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#mnt"><span class="nav-number">10.11.</span> <span class="nav-text">/mnt</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#lib"><span class="nav-number">10.12.</span> <span class="nav-text">/lib</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#tmp"><span class="nav-number">10.13.</span> <span class="nav-text">/tmp</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#var"><span class="nav-number">10.14.</span> <span class="nav-text">/var</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#lost-found"><span class="nav-number">10.15.</span> <span class="nav-text">/lost+found</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">zichong</span>

  
</div>


  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Muse</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/blogs/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/blogs/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/blogs/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/blogs/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blogs/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/blogs/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/blogs/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/blogs/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/blogs/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/blogs/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/blogs/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/blogs/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  

  
  

  

  

  

</body>
</html>
